//
//  DataCore.h
//  DianYingKe
//
//  Created by Blackie on 15/11/23.
//  Copyright © 2015年 Blackie. All rights reserved.
//
#import <Foundation/Foundation.h>

#import "AFNetworking.h"

@interface DataFetch : NSObject

/**
 * 获取缓存+请求数据（不解析数据）
 */
+ (void)getWithApi:(NSString *)api Dic:(NSMutableDictionary*)dic Completion:(void(^)(NSURLSessionDataTask *operation, id resultObj,NSString*link))completion Cache:(void(^)(id cacheObj))cache Fail:(void(^)(NSString* reason))fail;

+ (void)postWithApi:(NSString *)api Dic:(NSMutableDictionary*)dic Completion:(void(^)(NSURLSessionDataTask *operation, id resultObj,NSString*link))completion Cache:(void(^)(id cacheObj))cache Fail:(void(^)(NSString* reason))fail;

/**
 *  读取本地数据
 *
 *  @param api        请求接口
 *  @param completion 本地缓存
 *  @param failed     请求失败
 */
+ (void)fetctCacheWithApi:(NSString *)api Complition:(void(^)(NSArray *arrResult, NSString *api))completion failed:(void(^)(NSError *error, NSString *api))failed;

/**
 *  请求接口数据
 *
 *  @param api        请求接口
 *  @param completion 请求数据
 *  @param failed     请求失败
 */
+ (void)fetctRequestWithApi:(NSString *)api Complition:(void(^)(NSArray *arrResult, NSString *api))completion failed:(void(^)(NSError *error, NSString *api))failed;




+ (void)fetctKeyWordsRequestWithApi:(NSString *)api Complition:(void(^)(NSString *arrResult, NSString *api))completion failed:(void(^)(NSError *error, NSString *api))failed;
@end
